<?php
declare (strict_types=1);

namespace app\controller;
use app\model\User;
use think\facade\Request;

class StaticPages {
    public function home() {
        $topics = [];
        $count = 0;
        if(isLogin()){
            $user = loginUser();
            $topics =  $user->feed()->paginate(5);
            $count = $topics->total();
        }
        return view('home',compact('topics','count'));
    }

    public function help() {
        $str = '<script>alert("危险脚本，你cookie被拷贝走了!");</script>';
        return view('help',compact('str'));
    }

    public function about() {
        return view();
    }

    public function test(){
//        $user = loginUser();
//        $user->followings()->detach([10,8]);;
         Request::domain();
    }
}
